'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const {
      INTEGER,
      STRING,
      DATE,
      FLOAT,
    } = Sequelize;
    return await queryInterface.createTable('productinfo', {
      id: {
        type: INTEGER,
        allowNull: false,
        primaryKey: true,
        autoIncrement: true,
        comment: '序号',
      },
      productname: {
        type: STRING(200),
        comment: '商品名字',
      },
      explain: {
        type: STRING,
        comment: '说明',
      },
      tid: {
        type: STRING,
        comment: '所属类型',
      },
      price: {
        type: FLOAT,
        comment: '价格',
      },
      model: {
        type: 'STRING',
        comment: '型号',
      },
      tuji: {
        type: 'INTEGER',
        comment: '是否推荐',
      },
      activeprice: {
        type: FLOAT,
        comment: '活动价格',
      },
      activepricenum: {
        type: INTEGER,
        comment: '活动数量',
      },
      weight: {
        type: FLOAT,
        comment: '重量',
      },
      salesvolume: {
        type: INTEGER,
        comment: '销量',
      },
      fatiguereview: {
        type: INTEGER,
        comment: '评论',
      },
      integral: {
        type: INTEGER,
        comment: '送积分',
      },
      stock: {
        type: INTEGER,
        comment: '库存',
      },
      collection: {
        type: INTEGER,
        comment: '收藏人数',
      },
      productImg: {
        type: STRING(200),
        comment: '商品显示图片',
      },
      createdDate: {
        type: DATE,
        comment: '创建时间',
      },
    });
  },

  down: async queryInterface => {
    return await queryInterface.dropTable('productinfo');
  },
};
